
export default function isFiveSuccess(data,row,col) {
    return axis(data,row,col)||verticalAxis(data,row,col)||upAxis(data,row,col)||downAxis(data,row,col);

}

function axis(data,row,col) {
    let count = 1;
    for(let i =1;col-i >=0; i++){
        if(data[row][col] === data[row][col-i]){
            count++
        }else {
            break;
        }
    }
    for(let i=1; col+i <15; i++){
        if(data[row][col] === data[row][col+i]){
            count++;
        }else {
            break;
        }
    }
    return count >=5;

}
function verticalAxis(data,row,col) {
    let count = 1;
    for(let i =1;row-i >=0; i++){
        if(data[row][col] === data[row-i][col]){
            count++
        }else {
            break;
        }
    }
    for(let i=1; row+i <15; i++){
        if(data[row][col] === data[row+i][col]){
            count++;
        }else {
            break;
        }
    }
    return count >=5;

}

function upAxis(data,row,col) {
    let count = 1;
    for(let i =1;row-i >=0&&col+i<15; i++){
        if(data[row][col] === data[row-i][col+i]){
            count++
        }else {
            break;
        }
    }
    for(let i=1; row+i <15&&col-i>=0; i++){
        if(data[row][col] === data[row+i][col-i]){
            count++;
        }else {
            break;
        }
    }
    return count >=5;

}
function downAxis(data,row,col) {
    let count = 1;
    for(let i =1;row-i >=0&&col-i>=0; i++){
        if(data[row][col] === data[row-i][col-i]){
            count++
        }else {
            break;
        }
    }
    for(let i=1; row+i <15&&col+i<15; i++){
        if(data[row][col] === data[row+i][col+i]){
            count++;
        }else {
            break;
        }
    }
    return count >=5;

}